home *** CD-ROM | disk | FTP | other *** search
- #include <memory.h>
- #include <fonts.h>
- #include <textedit.h>
- #include <windows.h>
- #include <menus.h>
- #include <dialogs.h>
- #include <palette.h>
- #include <quickdraw.h>
- #include <packages.h>
- #include <desk.h>
- #include "Gif.h"
-
- extern CWindowPtr palWindow;
- extern CWindowPtr gifWindow;
- extern PaletteHandle thePalette;
-
- MainLoop()
- {
- Point where = {80,80};
- SFTypeList typeList;
- SFReply reply;
- Boolean done = FALSE;
- Boolean result;
- EventRecord theEvent;
- WindowPtr whichWindow;
-
- typeList[0] = 'GIFf';
- typeList[1] = 'TEXT';
-
- do {
- SFGetFile(where,'',NULL,2,&typeList,NIL,&reply);
- if (reply.good) {
- result = ProcessGIF(reply.fName,reply.vRefNum);
- if (result) {
- do {
- SystemTask();
- if (GetNextEvent(everyEvent, &theEvent)) {
- switch (theEvent.what) {
- case mouseDown:
- switch (FindWindow(theEvent.where, &whichWindow)) {
- case inGoAway:
- if (TrackGoAway(whichWindow, theEvent.where)) {
- done = TRUE;
- };
- break;
- default: ;
- }
- case keyDown:
- case autoKey: {
- register char theChar;
- theChar = theEvent.message & charCodeMask;
- if ( (theEvent.modifiers & cmdKey) != 0) {
- if (theChar == 'W' || theChar == 'w') {
- done = TRUE;
- }
- }
- }
- default: ;
- }
- }
- } while (!done);
- done = FALSE;
- DisposeWindow((WindowPtr) palWindow);
- DisposeWindow((WindowPtr) gifWindow);
- if (thePalette) {
- DisposePalette(thePalette);
- }
- }
- }
- } while (reply.good);
- }
-
- SetupMacintosh()
- {
- MaxApplZone();
- MoreMasters();
- MoreMasters();
- MoreMasters();
- MoreMasters();
-
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(NIL);
- }
-
- main()
- {
- SetupMacintosh();
- InitCursor();
-
- MainLoop();
- }
-